/* test_map.cpp */

#include <iostream>

#include <dodo_plot/dodo_plot.h>
#include <dodo_plot/map/plain_projection.h>
#include <dodo_plot/map/map.h>
#include <dodo_plot/map/map_grid.h>

using namespace std;
using namespace dodo_plot;
using namespace dodo_plot::color_name;

int main()
{
	Plain_Projection proj(60, 140, 0, 60);
	Map_Data states_data("idl_shape/cntry02.shp"); 
	Map_Data rivers_data("idl_shape/rivers.shp");
	Map_Data lakes_data("idl_shape/lakes.shp");

	Map<Plain_Projection> states_map(states_data, proj);
	Map<Plain_Projection> rivers_map(rivers_data, proj);
	Map<Plain_Projection> lakes_map(lakes_data, proj);

	states_map.set_fill_color(Color(0.95, 0.85, 0.6));
	states_map.set_line_width(0.6);
	rivers_map.set_line_color(BLUE);
	rivers_map.set_line_width(0.5);
	lakes_map.set_line_width(0.4);
	lakes_map.set_line_color(BLUE);
	lakes_map.set_fill_color(Color(0.1, 0.5, 0.9));
//	roads_map.set_line_color(Color(0.5, 0.5, 0.5));
//	roads_map.set_line_width(1.5);

	Map_Grid<Plain_Projection> grid(proj, 
		5, 5,
		60, 140,
		0, 60,
		0, 0);
	grid.set_line_color(Color(0.5, 0.5, 0.5));
//	Blank blank(2.0, 1.2);

	Blank blank(1.0, 1.0, Color(0.1, 0.5, 0.9));

	Label label("Generated by dodo_plot", 12, RIGHT);

	Picture final = frame(blank + states_map + rivers_map + lakes_map + grid, 1280, 800);
	final = combi(final, label, RIGHT_BOTTOM_INSIDE, -50, -10);

	Canvas canvas(1280, 800);
//		map.width(), map.height());
	canvas.draw(final);
	canvas.write_png("worldmap.png");

	return 0;
}
